<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 40px;
            background: #f5f5f5;
        }
        .container {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
        }
        .status {
            color: #67c23a;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>DataWorks 前端服务测试</h1>
        <p>如果你能看到这个页面，说明Nginx服务正常运行。</p>
        <p class="status">✓ 前端服务状态：正常</p>
        <p>当前时间：<span id="time"></span></p>
        
        <h2>API 测试</h2>
        <button onclick="testAPI()">测试后端API连接</button>
        <div id="api-result"></div>
    </div>

    <script>
        // 显示当前时间
        function updateTime() {
            document.getElementById('time').textContent = new Date().toLocaleString('zh-CN');
        }
        updateTime();
        setInterval(updateTime, 1000);

        // 测试API连接
        async function testAPI() {
            const resultDiv = document.getElementById('api-result');
            resultDiv.innerHTML = '<p>正在测试API连接...</p>';
            
            try {
                const response = await fetch('/api/health');
                if (response.ok) {
                    const data = await response.text();
                    resultDiv.innerHTML = '<p style="color: #67c23a;">✓ API连接正常: ' + data + '</p>';
                } else {
                    resultDiv.innerHTML = '<p style="color: #f56c6c;">✗ API连接失败: ' + response.status + '</p>';
                }
            } catch (error) {
                resultDiv.innerHTML = '<p style="color: #f56c6c;">✗ API连接错误: ' + error.message + '</p>';
            }
        }
    </script>
</body>
</html> 